import { DataSource } from 'typeorm';

export const indexProviders = [
  {
    provide: 'DATA_SOURCE',
    useFactory: async () => {
      const dataSource = new DataSource({
        type: 'mysql',
        host: 'rm-bp1ui74kj04va1q72.rwlb.rds.aliyuncs.com',
        port: 3306,
        username: 'app_mjz_saas',
        password: 'saas@MJZ',
        database: 'mold_fast_prod',
        entities: [
          __dirname + '/../**/*.entity{.ts,.js}',
        ],
        synchronize: false,
      });

      return dataSource.initialize();
    },
  },
];
